package engine;

import java.awt.Graphics2D;

import resources.manager.ResourceManager;

import com.golden.gamedev.GameEngine;
import com.golden.gamedev.GameObject;
import com.golden.gamedev.object.Background;
import com.golden.gamedev.object.Sprite;
import com.golden.gamedev.object.background.ImageBackground;

public class BeatGameMenu extends GameObject {

	private int myLevel;
	Background myBackground;
	Sprite myMessage;
	Sprite myClickMessage;

	public BeatGameMenu(GameEngine parent) {
		super(parent);
		ResourceManager manager = ResourceManager.getInstance();
		manager.addResourcesFromFile("menus");
		myBackground = new ImageBackground(getImage(manager.getString("background")));
		myMessage = new Sprite(getImage(manager.getString("congragulations")));
		myClickMessage = new Sprite(getImage(manager.getString("click")));
		myLevel=1;
	}

	@Override
	public void initResources() {
		
	}

	@Override
	public void render(Graphics2D g) {
		myBackground.render(g);
		myMessage.render(g);
		myClickMessage.render(g,150,300);
	}

	@Override
	public void update(long elapsedTime) {
		myBackground.update(elapsedTime);
		myMessage.update(elapsedTime);
		myClickMessage.update(elapsedTime);
		if(click()){
			((BubblefishEngine) parent).setLevel(myLevel);
			parent.nextGameID=0;
			finish();
		}
		

	}

}
